package chenji.watcher.core;

import java.util.LinkedHashSet;

public class WatchGroupData {
	private String start_Title;
	private int start_Time;
	private boolean back;
	private String end_Title;
	private int end_Time;
	private String name;
	private LinkedHashSet<WatchGroupTeleporter> tps = new LinkedHashSet<>();

	protected WatchGroupData(String starttitle, int startTime, String endTitle, int endTime, boolean back, String name) {
		this.start_Time = startTime;
		this.end_Time = endTime;
		this.start_Title = starttitle;
		this.end_Title = endTitle;
		this.back = back;
		this.name = name;
	}

	protected String getStartTitle() {
		return this.start_Title;
	}

	protected String getEndTitle() {
		return this.end_Title;
	}

	protected int getStartTime() {
		return this.start_Time;
	}

	protected int getEndTime() {
		return this.end_Time;
	}

	protected boolean canback() {
		return this.back;
	}

	protected void registerTeleporter(WatchGroupTeleporter t) {
		tps.add(t);
	}

	protected LinkedHashSet<WatchGroupTeleporter> getTPS() {
		return this.tps;
	}

	protected String getName() {
		return this.name;
	}

	protected boolean canPlay() {
		if (this.tps.isEmpty()) {
			return false;
		}
		return true;
	}

	public boolean containTeleporter(String name2) {
		for (WatchGroupTeleporter tr : this.tps) {
			if (tr.getName().equals(name2)) {
				return false;
			}
		}
		return true;
	}

	public boolean removeTeleporter(String name2) {
		WatchGroupTeleporter trd = null;
		for (WatchGroupTeleporter tr : this.tps) {
			if (tr.getName().equals(name2)) {
				trd = tr;
				break;
			}
		}
		if (trd == null) {
			return false;
		}
		this.tps.remove(trd);

		return true;
	}

	public void setStartTitle(String startTitle) {
		this.start_Title = startTitle;

	}

	public void setEndTitle(String endTitle) {
		this.end_Title = endTitle;

	}

	public void setStartTime(int time) {
		this.start_Time = time;

	}

	public void setEndTime(int time) {
		this.end_Time = time;

	}

	public WatchGroupTeleporter getTeleporter(String name2) {
		for (WatchGroupTeleporter tr : this.tps) {
			if (tr.getName().equals(name2)) {
				return tr;
			}
		}
		return null;
	}

	public void setBack(boolean b) {
		this.back = b;

	}
}
